package com.zt.securityTest.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zt.securityTest.entity.Menu;
import org.apache.ibatis.annotations.Select;

import java.util.List;

//这个方法类里面的表名爆红是因为没有在idea中连接数据库，如果连接了数据库会自动变颜色
public interface MenuMapper extends BaseMapper<Menu> {

    @Select("select t1.perms from sys_menu t1\n" +
            "inner join sys_role_menu  t2 on t1.id = t2.menu_id\n" +
            "inner join sys_role t3 on t3.id = t2.role_id \n" +
            "inner join sys_user_role t4 on t3.id = t4.role_id\n" +
            "inner join sys_user t5 on t5.id = t4.user_id\n" +
            "where t5.id = #{id}")
    List<String> getMenuByUserId(Long id);
}
